<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <title>generator</title>

</head>

<body>

    <script>

        function* dp()

        {

            yield "maicai";

            yield "zecai";

            yield "huoxian";

            yield "baojiaozi";

            return "dp";

        }

       

        let jiaozi=dp();

        for (let i of jiaozi)

        {

            console.log(i);

        }

        // console.log(typeof jiaozi);

        // let a=jiaozi.next();

        // console.log(a.value);

        // let b=jiaozi.next();

        // console.log(b.value);

        // let c=jiaozi.next();

        // let d=jiaozi.next();

        // let e=jiaozi.next();

        // let f=jiaozi.next();

        // console.log(c,d,e,f);

 

       

 

    </script>

</body>

</html>